package com.gdkm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gdkm.po.Drug;
import com.gdkm.po.Medical;
import com.gdkm.service.DrugService;
import com.gdkm.service.MedicalService;

@Controller

public class MedicalController {
	@Autowired
	MedicalService service;
	
	
	@RequestMapping("/medical")
	public String ss() {
		return "medical";
		
	}
	
	
	@ResponseBody
	@RequestMapping("/list5")
	public List get(int y) {
		List<Medical> list2 = service.list2((y-1)*8, 8);
		System.out.println(list2.toString());
		return list2;
	}
	@RequestMapping("/msave")
	public String save(String m_name, String m_type,String m_symptom,String m_grade,String m_phone, String m_sex,String dateOfOnSet,String dateOfConsultation ) {
		service.save1(m_name, m_type,m_symptom,m_grade,m_phone, m_sex,dateOfOnSet,dateOfConsultation);
		return "medical";
		
	}
	
	@ResponseBody
	@RequestMapping("/mlist")
	public List get(String m_name,String m_grade,int y) {
		 
		List<Medical> list = service.list3(m_name,m_grade,(y-1)*8, 8);
		System.out.println("模糊"+list);
		return list;
	}
	@RequestMapping("/mdel")
	public String del(int id) {
		service.delete1(id);
		return "medical";
	}
	//更新
	@RequestMapping("/mupdate")
    public String update(Medical stu){
        service.update(stu);
        System.out.print(stu);
        return  "medical";
}

}
